/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package FarmacieDAL;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Administrator
 */
@Entity
@Table(name = "STOCURI")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Stocuri.findAll", query = "SELECT s FROM Stocuri s"),
    @NamedQuery(name = "Stocuri.findByUm", query = "SELECT s FROM Stocuri s WHERE s.um = :um"),
    @NamedQuery(name = "Stocuri.findByCantitateActuala", query = "SELECT s FROM Stocuri s WHERE s.cantitateActuala = :cantitateActuala"),
    @NamedQuery(name = "Stocuri.findByIdStocuri", query = "SELECT s FROM Stocuri s WHERE s.idStocuri = :idStocuri")})
public class Stocuri implements Serializable {
    private static final long serialVersionUID = 1L;
    @Basic(optional = false)
    @Column(name = "UM")
    private String um;
    @Column(name = "CANTITATE_ACTUALA")
    private Integer cantitateActuala;
    @Id
    @Basic(optional = false)
    @Column(name = "ID_STOCURI")
    private Integer idStocuri;
    @JoinColumn(name = "ID_MEDICAMENT", referencedColumnName = "ID_MEDICAMENT")
    @OneToOne(optional = false)
    private Medicament idMedicament;

    public Stocuri() {
    }

    public Stocuri(Integer idStocuri) {
        this.idStocuri = idStocuri;
    }

    public Stocuri(Integer idStocuri, String um) {
        this.idStocuri = idStocuri;
        this.um = um;
    }

    public String getUm() {
        return um;
    }

    public void setUm(String um) {
        this.um = um;
    }

    public Integer getCantitateActuala() {
        return cantitateActuala;
    }

    public void setCantitateActuala(Integer cantitateActuala) {
        this.cantitateActuala = cantitateActuala;
    }

    public Integer getIdStocuri() {
        return idStocuri;
    }

    public void setIdStocuri(Integer idStocuri) {
        this.idStocuri = idStocuri;
    }

    public Medicament getIdMedicament() {
        return idMedicament;
    }

    public void setIdMedicament(Medicament idMedicament) {
        this.idMedicament = idMedicament;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idStocuri != null ? idStocuri.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Stocuri)) {
            return false;
        }
        Stocuri other = (Stocuri) object;
        if ((this.idStocuri == null && other.idStocuri != null) || (this.idStocuri != null && !this.idStocuri.equals(other.idStocuri))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "FarmacieDAL.Stocuri[ idStocuri=" + idStocuri + " ]";
    }
    
}
